DevForce Help Reference
Or<T>(Expression<Func<T,Boolean>>[]) Method
Example 


Expressions to be OR'ed
Returns an expression which represents a conditional OR operation of the specified operands.
Syntax
'Declaration
 
Public Overloads Shared Function Or(Of T)( _
   ByVal ParamArray expressions() As Expression(Of Func(Of T,Boolean)) _
) As Expression(Of Func(Of T,Boolean))
'Usage
 
Dim expressions() As Expression(Of Func(Of T,Boolean))
Dim value As Expression(Of Func(Of T,Boolean))
 
value = PredicateBuilder.Or(Of T)(expressions)

Parameters

expressions
Expressions to be OR'ed

Type Parameters

T
Remarks
The resulting expression is an "OrElse" binary expression of all operands provided.
Example
public void OrQuery2() {
  var mgr = new DomainModelEntityManager();
  Expression<Func<Customer, bool>> crit1 = c => c.Country.Equals("Mexico");
  Expression<Func<Customer, bool>> crit2 = c => c.CompanyName.StartsWith("A");
  Expression<Func<Customer, bool>> crit3 = c => c.City.StartsWith("M");

  // 'or' all criteria.
  var finalcrit = PredicateBuilder.Or(crit1, crit2, crit3);
  var results = mgr.Customers.Where(finalcrit).ToList();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PredicateBuilder Class
PredicateBuilder Members
Overload List

Send Feedback